package com.timber.util;

import java.io.Serializable;
import java.sql.ResultSet;
import java.sql.SQLException;

public class BillBean extends SLDataObjectAdaptor implements Serializable  {
	
	//	bean 
	String   ItemId  ;   
	String timberName; 
	String tClass	;  
	String mesurement;
	double lenght; 
	double width ;
	double sQuantity ;
	double salesRate; 
	double tax; 
	double total;
	double amount;
	double units;
	int InvoiceNumber;
	public String getItemId() {
		return ItemId;
	}
	public void setItemId(String itemId) {
		ItemId = itemId;
	}
	public double getLenght() {
		return lenght;
	}
	public void setLenght(double lenght) {
		this.lenght = lenght;
	}
	public double getSalesRate() {
		return salesRate;
	}
	public void setSalesRate(double salesRate) {
		this.salesRate = salesRate;
	}
	public double getSQuantity() {
		return sQuantity;
	}
	public void setSQuantity(double quantity) {
		sQuantity = quantity;
	}
	public double getTax() {
		// tax percnetage should return from property file 
		return tax;
	}
	public void setTax(double tax) {
		this.tax = tax;
	}
	public String getTClass() {
		return tClass;
	}
	public void setTClass(String class1) {
		tClass = class1;
	}
	public String getTimberName() {
		return timberName;
	}
	public void setTimberName(String timberName) {
		this.timberName = timberName;
	}
	public double getTotal() {
		return total;
	}
	public void setTotal(double total) {
		this.total = total;
	}
	public double getWidth() {
		return width;
	}
	public void setWidth(double width) {
		this.width = width;
	}
	public double getAmount() {
		return amount;
	}
	public void setAmount(double amount) {
		this.amount = amount;
	} 
	
	
	/**
	 * @return Returns the invoiceNumber.
	 */
	public int getInvoiceNumber() {
		return InvoiceNumber;
	}
	/**
	 * @param invoiceNumber The invoiceNumber to set.
	 */
	public void setInvoiceNumber(int invoiceNumber) {
		InvoiceNumber = invoiceNumber;
	}
	
	
	String ITEM_ID    		 ="ItemId"			;
	String ITEM_CODE    	 ="ItemCode"		;
	String	TYPE			 ="Type"            ;   
	String	TIMBER_NAME		 ="ItemName"        ;	
	String	TIMBER_CLASS	 = "ItemClass"		;	
	String	TIMBER_LENGTH	 ="Length"  		;	
	String	TIMBER_WIDTH     ="Width"			;	
	String	SALESPRICE       ="SalesPrice"		;	
	String	PROFITMARGIN     ="ProfitMargin"   	;	
	String	MEASURMENT       ="Measurement"    	;
	String	UNITS    		  ="Units"			;
	String	QUANTITY         ="Quantity"		;	
	String	TAX            	 ="Tax"				;
	String	AMOUNT    		  ="Amount"			;
	String	TOTAL    		  ="Total"			;
	
	public boolean load(ResultSet rs) throws SQLException
	{
		ItemId=rs.getString(ITEM_CODE);     
		timberName	=rs.getString(TIMBER_NAME);
		tClass	=rs.getString(TIMBER_CLASS);
		lenght =rs.getDouble(TIMBER_LENGTH);
		width =rs.getDouble(TIMBER_WIDTH);
		units =rs.getDouble(UNITS);
		amount=rs.getDouble(AMOUNT);
		mesurement=rs.getString(MEASURMENT);
		sQuantity =rs.getDouble(QUANTITY);
		salesRate=rs.getDouble(SALESPRICE);
		tax = rs.getDouble(TAX);
		total =rs.getDouble(TOTAL);
		return true;
	}
	
	public BillBean()
	
	{
	}
	
	
	
	public BillBean( BillBean rawItem )
	
	{
		this.ItemId=rawItem.getItemId() ;
		this.timberName = rawItem.getTimberName(); 
		this.tClass	= rawItem.getTClass();
		this.lenght	= rawItem.getLenght();
		this.width 	= rawItem.getWidth();
		this.amount	= rawItem.getAmount();
		this.sQuantity = rawItem.getSQuantity();
		this.tax 		= rawItem.getTax();
		this.units 		= rawItem.getUnits();
		this.mesurement =  rawItem.getMesurement();
	}
	/**
	 * @return Returns the units.
	 */
	public double getUnits() {
		return units;
	}
	/**
	 * @param units The units to set.
	 */
	public void setUnits(double units) {
		this.units = units;
	}
	/**
	 * @return Returns the mesurement.
	 */
	public String getMesurement() {
		return mesurement;
	}
	/**
	 * @param mesurement The mesurement to set.
	 */
	public void setMesurement(String mesurement) {
		this.mesurement = mesurement;
	}
}
